<h3 class="page-title">上刊单管理</h3>
<div class="table-custom">
    <div class="portlet">
        <div class="portlet-title">
            <button class="btn btn-success title-action" ng-click="billAddModal.open();"
                    tabindex="0">
                <i class="fa fa-plus"></i> 上刊申请
            </button>
            <a href="javascript:void(0);" class="title-operation search-expand">筛选</a>
            <div class="title-search-box">
                <input type="text" placeholder="请输入上刊单号" class="search-field"
                       style="width: 180px;" maxlength="100" ng-model="publishBillGrid.query.quickSearchName">
                <a class="fa fa-search" ng-click="publishBillGrid.query(publishBillGrid.query.quickSearch = 1)"></a>
            </div>
        </div>
        <div class="portlet-search-body" style="display: none;">
            <form class="form-inline" role="form">
                <div class="form-group">
                    <div class="col-md-4">
                        <div class="input-icon">
                            <i class="fa fa-indent"></i>
                            <input class="form-control" placeholder="上刊单号" ng-model="publishBillGrid.query.billNo">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-4">
                        <div class="input-icon">
                            <i class="fa fa-user"></i>
                            <input class="form-control" placeholder="客户名称" ng-model="publishBillGrid.query.customerName">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-4">
                        <div class="input-icon">
                            <i class="fa fa-mobile-phone"></i>
                            <input class="form-control" placeholder="联系电话" ng-model="publishBillGrid.query.contactsPhone">
                        </div>
                    </div>
                </div>
                <button class="btn btn-primary" ng-click="publishBillGrid.query(publishBillGrid.query.quickSearch = 0)"><i class="fa fa-search"></i> 搜索</button>

                <button class="btn btn-primary" ng-click="publishBillGrid.reset()"><i class="fa fa-rotate-left"></i> 重置</button>
            </form>
        </div>
        <div class="portlet-body" style="width: 100%">
            <table ed-grid="publishBillGrid" class="table table-striped table-bordered table-hover dataTable"
                   ed-url="publishBill/query.do" ed-model="publishBill" style="width: 100%">
                <thead>
                <tr>
                    <th ed-data="_index"></th>
                    <th ed-data="billNo">上刊单号</th>
                    <th ed-data="billType | code : 'publishBillType'">类型</th>
                    <th ed-data="customerName">经营单位</th>
                    <th ed-data="contacts">联系人</th>
                    <th ed-data="contactsPhone">联系电话</th>
                    <th ed-data="publishTime" width="135px">上刊开始时间</th>
                    <th ed-data="publishOffTime" width="135px">上刊截止时间</th>
                    <th ed-data="applyTime" width="135px">申请时间</th>
                    <th ed-data="publishBillStatus | code : 'publishBillStatus'">状态</th>
                    <th width="250px">操作</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
</div>


<div ed-modal="scheduleModal" data-options="width:'900px',static:true,title: '上刊明细',
    icon: 'glyphicon glyphicon-briefcase'" >
    <div ng-include="'views/publish/publish_schedule.html'" style="height: 500px;">
    </div>
</div>

<div ed-modal="billAddModal" data-options="width:'1000px',static:true,title: '上刊申请',
    icon: 'glyphicon glyphicon-briefcase'" >
    <div class="form" style="height: 600px">
        <form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="addValidateForm1">
            <div class="form-body" >
                	<div class="row">
                		<div class="col-md-6">
                			<div class="form-group">
		                        <label class="col-md-3 control-label"><span class="required">*</span>经营单位</label>
		                        <div class="col-md-8">
		                            <select id="billAddModalCustomerId" class="form-control" name="customerId" ng-model="billAddModal.publishBill.customerId"
		                                    ng-options="opt.customerId as opt.customerName for opt in customerList" required></select>
		                        </div>
	                        </div>
	                    </div>
	                    <div class="col-md-6">
	                    	<div class="form-group">
		                        <label class="col-md-3 control-label"><span class="required">*</span>上刊类型</label>
									<div class="col-md-4">
										<select id="billAddModalbillType" class="form-control input-inline" name="billType" ng-model="billAddModal.publishBill.billType" style="width: 120px;display: inline-block;"
												ng-options="opt.value as opt.name for opt in options.publishBillType" required></select>
									</div>
									<div class="col-md-4">
										<select id="billAddModalmediaType"  class="form-control input-inline" name="mediaType" ng-model="billAddModal.publishBill.mediaType" style="width: 120px;display: inline-block;"
												ng-options="opt.value as opt.name for opt in billAddModal.mediaTypes" required></select>
									</div>
		                    </div>
	                     </div>
                    </div>
                   	<div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                    	<label class="col-md-3 control-label"><span class="required">*</span>起始时间</label>
		                        <div class="col-md-8">
		                            <input type="text" class="form-control" name="publishTime" ed-date-picker
                                   ng-model="billAddModal.publishBill.publishTime" required>
		                        </div>
		                    </div>
		              	</div>
		              	<div class="col-md-6">
		                    <div class="form-group">
		                    	<label class="col-md-3 control-label"><span class="required">*</span>截止时间</label>
		                        <div class="col-md-8">
		                            <input type="text" class="form-control" name="publishOffTime" ed-date-picker
                                   ng-model="billAddModal.publishBill.publishOffTime" required>
		                        </div>
		                    </div>
		              	</div>
	           		</div>
                    <div class="row">
                    	<div class="col-md-6">
		                    <div class="form-group">
		                    	<label class="col-md-3 control-label"><span class="required">*</span>广告内容</label>
		                         <div class="col-md-8">
		                            <input type="text" class="form-control" name="contractNo"
		                                   ng-model="billAddModal.publishBill.content" required>
		                        </div>
		                    </div>
		              	</div>
		              	<div class="col-md-6">
		                    <div class="form-group">
		                    	<label class="col-md-3 control-label">申请资料</label>
		                         <div class="col-md-8">
                       				<div ed-uploader data-options="text:' 文件上传',multiple: false" class="ng-uploader" ng-model="billAddModal.publishFile"></div>
                       				<div style="display: inline-block;white-spacing:nowrap;" ng-show="billAddModal.publishFile">
                       					<a style="color: gray;" href="javascript:void(0);" ng-click="billAddModal.removePublishFile();"  class="fa fa-close">{{billAddModal.publishFile.name}}</a>
                       				</div>
               					 </div>
		                    </div>
		              	</div>
	           		</div>
	           		<div class="row">
		           		<div class="col-md-12">
			                    <div class="form-group">
			                        <div class="col-md-12">
                        				<div ed-uploader data-options="text:' 样刊文件',multiple: true,maxLength:3,accept:'image/*'" class="ng-uploader" style="vertical-align:top;" ng-model="billAddModal.adModelImgs"></div>
                        				<div style="display: inline-block;width: 100px;margin-left: 10px;position: relative;" ng-repeat="img in billAddModal.adModelImgs">
                        					<img ng-src="{{nginxPath+img.path}}" style="width: 100px;height: 100px;border: lightgray 1px solid;">
                        					<a style="position: absolute;top:0px;right:0px;color: lightgray;" href="javascript:void(0);" ng-click="billAddModal.removeAdModelImg(img);" title="{{img.name}}" class="fa fa-close"></a>
                        				</div>
                   					</div>
			                    </div>
			            </div>
	           		</div>
	           		<div class="row">
                       	<button type="button" class="btn btn-success" ng-click="billAddModal.clickAdd()"> <i class="fa fa-check-square-o"></i> 编辑明细 </button>
                    </div>
		            <div class="tabbable-custom" ng-if="billAddModal.busResources.elements.length == 0 && billAddModal.stopResources.elements.length == 0">
						<div style="font-size:30px;height: 120px;color:#E8E0E0;border: 3px dotted #E8E0E0;text-align: center;"><div style="text-align:center;margin:35px auto;">请编辑上刊明细</div></div>
					</div>
                    <div ng-show="billAddModal.publishBill.billType == '1'">
                        <div class="portlet-body" ng-show="billAddModal.busResources.elements.length > 0">
                            <table class="table table-striped table-bordered table-hover dataTable" style="border-top:0px;">
                                <thead>
                                    <tr>
                                    	<th style="text-align: center">资源编号</th>
                                    	<th style="text-align: center">车型</th>
                                        <th style="text-align: center">车牌号</th>
                                        <th style="text-align: center">自编号</th>
                                        <th style="text-align: center">线路</th>
                                        <th style="text-align: center">所属公司</th>
                                        <th style="width: 34px;text-align: center">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="resource in billAddModal.busResources.elements">
                                    	<td style="text-align: center;">
                                            {{resource.value.resourceCode}}
                                        </td>
                                        <td style="text-align: center;">
											{{resource.value.busFloor | code:'BUS_FLOOR'}}
										</td>
                                        <td style="text-align: center;">
                                            {{resource.value.plateNo}}
                                        </td>
                                        <td style="text-align: center;">
                                            {{resource.value.vehicleNo}}
                                        </td>
                                        <td style="text-align: center;">
                                            {{resource.value.lineNo}}
                                        </td>
                                        <td style="text-align: center;">
                                            {{resource.value.companyName}}
                                        </td>
                                        <td style="text-align: center;">
                                            <button type="button" class="btn btn-xs btn btn-delete" ng-click="billAddModal.removeResources(resource.value)">
                                                <i class="fa fa-trash-o"></i> 删除
                                            </button>
                                        </td>
                                    </tr>
                                </table>
                            </table>
                        </div>
                    </div>
                    <div ng-show="billAddModal.publishBill.billType == '2'">
                            <div class="portlet-body" ng-show="billAddModal.stopResources.elements.length > 0">
                                <table class="table table-striped table-bordered table-hover dataTable" style="border-top:0px;">
                                    <thead>
                                        <tr>
                                        	<th style="text-align: center">资源编号</th>
                                            <th style="text-align: center">站点名称</th>
                                            <th style="text-align: center">街道</th>
                                            <th style="text-align: center">行向</th>
                                            <th style="width: 34px;text-align: center">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-repeat="resource in billAddModal.stopResources.elements">
                                        	<td style="text-align: center;">
                                            	{{resource.value.resourceCode}}
                                        	</td>
                                            <td style="text-align: center;">
                                                {{resource.value.stopName}}
                                            </td>
                                            <td style="text-align: center;">
                                                {{resource.value.roadName}}
                                            </td>
                                            <td style="text-align: center;">
                                                {{resource.value.direction}}
                                            </td>
                                            <td style="text-align: center;">
                                                <button type="button" class="btn btn-xs btn btn-danger" ng-click="billAddModal.removeResources(resource.value)">
                                                    <i class="fa fa-trash-o"></i> 删除
                                                </button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                    </div>
            </div>

        </form>
    </div>
</div>

<div ed-modal="billViewModal" data-options="width:'1000px',static:true,title: '上刊单',
    icon: 'glyphicon glyphicon-briefcase',defaultButton:false">
    <div class="form" style="overflow: auto;height: 600px;">
        <form class="form-horizontal">
            <div class="form-body">
            	<div class="row" style="text-align: center;margin-bottom: 0px;">
            		<h4 style="font-weight: bold;">{{billViewModal.bill.customerName}} {{billViewModal.bill.billType | code:'publishBillType'}}</h4>
            	</div>
            	<div class="row">
					<div class="col-md-4">
						<div class="form-group" style="margin-bottom: 0px;">
							<label class="col-md-4 control-label">
								广告内容:
							</label>
							<div class="col-md-8">
								<p class='form-control-static'>{{billViewModal.bill.content}}   </p> 
							</div>
						</div>
					</div>
					<div class="col-md-5">
						<div class="form-group" style="margin-bottom: 0px;">
							<label class="col-md-4 control-label">
								上刊周期:
							</label>
							<div class="col-md-8">
									<p class='form-control-static'>{{billViewModal.bill.publishTime | limitTo:10}} 至 {{billViewModal.bill.publishOffTime | limitTo:10}}</p> 
							</div>
						</div>
					</div>
					<div class="col-md-3">
						<div class="form-group" style="margin-bottom: 0px;">
							<div class="col-md-5">
								<a  ng-show="billViewModal.publishFile" ng-href="{{nginxPath+billViewModal.publishFile.path}}" target="_blank">资料下载</a></p>
							</div>
						</div>
					</div>
				</div>
				<div class="row" ng-show="billViewModal.adModelImgs">
					<div class="col-md-12">
						<div class="form-group" style="margin-bottom: 0px;">
							<label class="col-md-1 control-label" style="padding-right: 0px;">
								样&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;刊:
							</label>
							<div class="col-md-11">
								<div style="display: inline-block;width: 100px;margin-left: 10px;position: relative;" ng-repeat="img in billViewModal.adModelImgs">
                        			<img ng-src="{{nginxPath+img.path}}" style="width: 100px;height: 100px;border: lightgray 1px solid;">
                        		</div>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div ng-show="billViewModal.bill.billType == '1'" class="portlet-body"
						style="width: 100%;">
						<table
							class="table table-striped table-bordered table-hover dataTable"
							style="border-top: 0px;">
							<thead>
								<tr>
									<th style="text-align: center">
										资源编号
									</th>
									<th style="text-align: center">
										媒体形式
									</th>
									<th style="text-align: center">
										车型
									</th>
									<th style="text-align: center">
										车牌号
									</th>
									<th style="text-align: center">
										自编号
									</th>
									<th style="text-align: center">
										线路
									</th>
									<th style="text-align: center">
										营运公司
									</th>
								</tr>
							</thead>
							<tbody>
								<tr ng-repeat="resource in billViewModal.bill.billDetails">
									<td style="text-align: center;">
										{{resource.resourceCode}}
									</td>
									<td style="text-align: center;">
										{{resource.mediaName}}
									</td>
									<td style="text-align: center;">
										{{resource.busFloor | code:'BUS_FLOOR'}}
									</td>
									<td style="text-align: center;">
										{{resource.plateNo}}
									</td>
									<td style="text-align: center;">
										{{resource.vehicleNo}}
									</td>
									<td style="text-align: center;">
										{{resource.lineNo}}
									</td>
									<td style="text-align: center;">
										{{resource.companyName}}
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div ng-show="billViewModal.bill.billType == '2'" class="portlet-body"
						style="width: 100%;">
						<table
							class="table table-striped table-bordered table-hover dataTable"
							style="border-top: 0px;">
							<thead>
								<tr>
									<th style="text-align: center">
										资源编号
									</th>
									<th style="text-align: center">
										媒体形式
									</th>
									<th style="text-align: center">
										站点名称
									</th>
									<th style="text-align: center">
										所在街道
									</th>
									<th style="text-align: center">
										行向
									</th>
								</tr>
							</thead>
							<tbody>
								<tr ng-repeat="resource in billViewModal.bill.billDetails">
									<td style="text-align: center;">
										{{resource.resourceCode}}
									</td>
									<td style="text-align: center;">
										{{resource.mediaName}}
									</td>
									<td style="text-align: center;">
										{{resource.stopName}}
									</td>
									<td style="text-align: center;">
										{{resource.roadName}}
									</td>
									<td style="text-align: center;">
										{{resource.direction}}
									</td>
			
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</form>
        
    </div>
</div>

<div ed-modal="makeBillViewModal" data-options="width:'1000px',static:true,title: '上刊详情',
    icon: 'glyphicon glyphicon-briefcase',defaultButton:false" >
    <div class="form" style="overflow: auto;height: 600px;">
        <form class="form-horizontal">
            <div class="form-body">
            	<div class="row" style="text-align: center;margin-bottom: 0px;">
            		<h4 style="font-weight: bold;">{{makeBillViewModal.customer.customerName}} {{makeBillViewModal.publishBill.billType | code:'publishBillType'}}</h4>
            	</div>
            	<div class="row">
					<div class="col-md-4">
						<div class="form-group" style="margin-bottom: 0px;">
							<label class="col-md-4 control-label">
								广告内容:
							</label>
							<div class="col-md-8">
								<p class='form-control-static'>{{makeBillViewModal.publishBill.content}}</p> 
							</div>
						</div>
					</div>
					<div class="col-md-5">
						<div class="form-group" style="margin-bottom: 0px;">
							<label class="col-md-4 control-label">
								上刊周期:
							</label>
							<div class="col-md-8">
									<p class='form-control-static'>{{makeBillViewModal.publishBill.publishTime | limitTo:10}} 至 {{makeBillViewModal.publishBill.publishOffTime | limitTo:10}}</p> 
							</div>
						</div>
					</div>
					<div class="col-md-3">
						<div class="form-group" style="margin-bottom: 0px;">
							<div class="col-md-5">
								<a ng-if="makeBillViewModal.publishFile" ng-href="{{nginxPath+makeBillViewModal.publishFile.path}}" target="_blank">资料下载</a></p>
							</div>
						</div>
					</div>
				</div>
				<div class="row" ng-show="makeBillViewModal.adModelImgs">
					<div class="col-md-12">
						<div class="form-group" style="margin-bottom: 0px;">
							<label class="col-md-1 control-label" style="padding-right: 0px;">
								样&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;刊:
							</label>
							<div class="col-md-11">
								<div style="display: inline-block;width: 100px;margin-left: 10px;position: relative;" ng-repeat="img in makeBillViewModal.adModelImgs">
                        			<img ng-src="{{nginxPath+img.path}}" style="width: 100px;height: 100px;border: lightgray 1px solid;">
                        		</div>
							</div>
						</div>
					</div>
				</div>
				<div class="row" ng-repeat="mkBill in makeBillViewModal.makeBills">
					<div ng-show="makeBillViewModal.publishBill.billType == '1'" class="portlet-body"
						style="width: 100%;">
						<table
							class="table table-striped table-bordered table-hover dataTable"
							style="border-top: 0px;">
							<thead>
								<tr>
									<th style="text-align: center">
										资源编号
									</th>
									<th style="text-align: center">
										媒体形式
									</th>
									<th style="text-align: center">
										车型
									</th>
									<th style="text-align: center">
										车牌号
									</th>
									<th style="text-align: center">
										自编号
									</th>
									<th style="text-align: center">
										线路
									</th>
									<th style="text-align: center">
										营运公司
									</th>
									<th style="text-align: center">
										制作状态
									</th>
									<th style="text-align: center">
										完成时间
									</th>
								</tr>
							</thead>
							<tbody>
								<tr ng-repeat="resource in mkBill.detls">
									<td style="text-align: center;">
										{{resource.resourceCode}}
									</td>
									<td style="text-align: center;">
										{{resource.mediaName}}
									</td>
									<td style="text-align: center;">
										{{resource.busFloor | code:'BUS_FLOOR'}}
									</td>
									<td style="text-align: center;">
										{{resource.plateNo}}
									</td>
									<td style="text-align: center;">
										{{resource.vehicleNo}}
									</td>
									<td style="text-align: center;">
										{{resource.lineNo}}
									</td>
									<td style="text-align: center;">
										{{resource.companyName}}
									</td>
									<td style="text-align: center;">
										{{resource.makeBillDetailStatus == 1 ? '未完工' : '已完工'}}
									</td>
									<td style="text-align: center;">
										{{resource.complateTime}}
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div ng-show="makeBillViewModal.publishBill.billType == '2'" class="portlet-body"
						style="width: 100%;">
						<table
							class="table table-striped table-bordered table-hover dataTable"
							style="border-top: 0px;">
							<thead>
								<tr>
									<th style="text-align: center">
										资源编号
									</th>
									<th style="text-align: center">
										媒体形式
									</th>
									<th style="text-align: center">
										站点名称
									</th>
									<th style="text-align: center">
										所在街道
									</th>
									<th style="text-align: center">
										行向
									</th>
									<th style="text-align: center">
										制作状态
									</th>
									<th style="text-align: center">
										完成时间
									</th>
								</tr>
							</thead>
							<tbody>
								<tr ng-repeat="resource in mkBill.detls">
									<td style="text-align: center;">
										{{resource.resourceCode}}
									</td>
									<td style="text-align: center;">
										{{resource.mediaName}}
									</td>
									<td style="text-align: center;">
										{{resource.stopName}}
									</td>
									<td style="text-align: center;">
										{{resource.roadName}}
									</td>
									<td style="text-align: center;">
										{{resource.direction}}
									</td>
									<td style="text-align: center;">
										{{resource.makeBillDetailStatus == 1 ? '未完工' : '已完工'}}
									</td>
									<td style="text-align: center;">
										{{resource.complateTime}}
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</form>
        
    </div>
</div>

